#pragma once
#include <iostream>
#include <string>
#include <sstream>
#include "Util.hpp"
using namespace std;
#define SEP "\r\n"
#define DEFAULT_PATH "./wwwroot"
#define HOME_PAGE "index.html"
class Request
{
public:
    Request() {}
    ~Request() {}

    void parse(const string &in)
    {
        inbuffer = in;
        string firstLine = Util::getLine(inbuffer, SEP);
        stringstream s(firstLine);
        s >> method >> url >> httpversion;

        path = DEFAULT_PATH;
        path += url;
        if (path[path.size() - 1] == '/')
            path += HOME_PAGE;
        else
            path += ".html";
    }

public:
    string inbuffer;
    string method;
    string url;
    string path;
    string httpversion;
    string suffix;
    string parm;
};
class Response
{
public:
    string outbuffer;
};
